import React, { Component } from "react";

class Child1 extends Component {
  state = {
    count: 10,
  };

  emit() {
    this.props.onGetCount(this.state.count);
  }

  render() {
    // console.log(this);
    return (
      <div>
        child1组件 - {this.state.count} -
        {/* 点击按钮的时候，可以触发父组件的自定义事件 */}
        <button onClick={this.emit.bind(this)}>btn</button>
      </div>
    );
  }
}

export default Child1;
